<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui">


    <ui:define name="content">

        <h:panelGroup >
            <h:form  >
                <p:panel >
                    <f:facet name="header" >
                        <h:outputLabel value="Manage Pharmaceutical Item Categories" ></h:outputLabel>
                        <p:commandButton value="Back" ajax="false" action="/pharmacy/pharmacy_admin" icon="ui-icon-circle-triangle-w" style="float: right;" ></p:commandButton>
                    </f:facet>

                    <p:panel>
                        <h:panelGrid columns="2" id="pan" >
                            <p:selectOneRadio value="#{dataAdministrationController.reportKeyWord.string}" >
                                <f:selectItem itemLabel="Active" itemValue="0"/>
                                <f:selectItem itemLabel="De-Active" itemValue="1"/>
                                <f:ajax event="change" execute="@this" render="pan" />
                            </p:selectOneRadio>
                            <p:commandButton value="Fill" action="#{dataAdministrationController.fillPharmacyCategory()}" ajax="false" />
                            <p:commandButton rendered="#{dataAdministrationController.reportKeyWord.string eq '1'}" ajax="false"
                                             value="Active Categories" action="#{dataAdministrationController.actveSelectedCategories()}" />
                            <p:commandButton rendered="#{dataAdministrationController.reportKeyWord.string eq '0'}" ajax="false"
                                             value="De-Active Categories" action="#{dataAdministrationController.deActveSelectedCategories()}" />
                        </h:panelGrid>
                        <p:dataTable value="#{dataAdministrationController.pharmaceuticalItemCategorys}" var="c" 
                                     selection="#{dataAdministrationController.selectedPharmaceuticalItemCategorys}" rowKey="#{c.id}">
                            <p:column selectionMode="multiple"></p:column>
                            <p:column>
                                <f:facet name="header">
                                    <p:outputLabel value="Name" />
                                </f:facet>
                                <p:outputLabel value="#{c.name}" />
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <p:outputLabel value="Code" />
                                </f:facet>
                                <p:outputLabel value="#{c.description}" />
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <p:outputLabel value="Status" />
                                </f:facet>
                                <p:outputLabel value="#{c.retired}" />
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <p:outputLabel value="Retired At" />
                                </f:facet>
                                <p:outputLabel value="#{c.retiredAt}" >
                                    <f:convertDateTime pattern="yyyy MM dd hh:mm:ss a" />
                                </p:outputLabel>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <p:outputLabel value="Retired User" />
                                </f:facet>
                                <p:outputLabel value="#{c.retirer.webUserPerson.name}" />
                            </p:column>
F                        </p:dataTable>
                    </p:panel>
                </p:panel>
            </h:form>
        </h:panelGroup>

    </ui:define>

</ui:composition>
